var mgeNspm = {
    tableid: "table1",
    layerindex: null,
    bsTable: null,
    idselect: null
};


mgeNspm.initColumn = function () {
    return [[{
        field: 'selectItem', radio: true
    }, {
        title: '登记序号', field: 'djxh', width: "100px", halign: 'center', align: 'right', valign: 'middle'
    }, {
        title: '企业名称', field: 'nsrmc', width: "200px", halign: 'center', align: 'left', valign: 'middle', formatter: function (v) {
            return v;
        }
    }, {
        title: '社会信用代码', field: 'shxydm', width: "150px", halign: 'center', align: 'right', valign: 'middle', formatter: function (v) {
            return v;
        }
    }, {
        title: '行业', field: 'hy', width: "150px", halign: 'center', align: 'left', valign: 'middle', formatter: function (v, row) {
            return v;
        }
    }, {
        title: '纳税人状态', field: 'nsrzt', width: "170px", halign: 'center', align: 'left', valign: 'middle', formatter: function (v, r, i) {
            return v;
        }
    }, {
        title: '开业人数', field: 'kyrs', width: "120px", halign: 'center', align: 'right', valign: 'middle', formatter: function (v, r, i) {
            return v;
        }
    }, {
        title: '年度', field: 'nd', width: "150px", halign: 'center', align: 'right', valign: 'middle', formatter: function (v, row) {
            return v;
        }
    }
        , {
            title: '入库税额', field: 'rkse', width: "150px", halign: 'center', align: 'right', valign: 'middle', formatter: function (v, row) {
                return v;
            }
        }]];
}
mgeNspm.queryParams = function () {
    return cmm.serializeObject($("#form_search"));
}
mgeNspm.resHeigth = function () {
    var he = $(window).height() - ($("#divsearch").height() + 20);
    return he;
}
mgeNspm.select = function () {
    var s = $(".bs-select").chosen({width: '100%', disable_search: true});
    //show.bs.select
    //shown.bs.select 当下拉菜单对用户可见出发
    //loaded.bs.select 初始化后触发
    //hide.bs.select
    $(".bs-select").on("change", function (e, params) {

    });
    return s;
}

var myLayout;
$(function () {
    myLayout = $('body').layout({
        north__minSize: 50
        , north__maxSize: 400,
        togglerContent_open: '<div class="ui-icon"></div>', togglerContent_closed: '<div class="ui-icon"></div>'
    });
    var bs = new BgdataTable();
    var opt = new BgOption(mgeNspm.tableid, ctx + "/mge/adx/syfx/zhfx/queryNspmfxList?rad=" + new Date().getTime(), mgeNspm.initColumn(), mgeNspm.queryParams(), mgeNspm.resHeigth());
    /* opt.toolbarId = "table1Toolbar";
     opt.onClickRow = function (row, el, field) {
     if (row.userId == "1") {
     $("#update").hide();
     $("#del").hide();
     } else {
     $("#update").show();
     $("#del").show();
     }
     }*/
    bs.draw(opt);
    mgeNspm.bsTable = bs;
    $("#form_search").on("submit", function (e) {
        bs.refresh(mgeNspm.queryParams());
        return false;
    });
    /* mgeUser.addOnClick();
     mgeUser.updateOnClick();
     mgeUser.delOnClick();*/
    mgeNspm.idselect = mgeNspm.select();
});